﻿<local:ChoBaseWindowEx x:Class="ChoWorkflowDashboard.AddOrEditUserWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:ChoWorkflowDashboard"
        xmlns:cinchoo="clr-namespace:Cinchoo.Core;assembly=Cinchoo.Core"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:tk="http://schemas.microsoft.com/wpf/2008/toolkit"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" 
        Title="Users Editor" 
        Height="408" Width="441" MinWidth="400" MinHeight="400"
        ShowInTaskbar="False" 
        Topmost="False" Top="0"
        ShowMaxRestoreButton="false" ShowMinButton="false"
        BorderBrush="{DynamicResource AccentColorBrush}"
        BorderThickness="1"
                       >

    <DockPanel >
        <StackPanel DockPanel.Dock="Bottom" Margin="2"  Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Margin="2" Content="Cancel" Height="23" Name="btnCancel" Width="75" Click="btnCancel_Click" IsCancel="True" TabIndex="7" />
            <Button Margin="2" Content="OK" Height="23" Name="btnOK" Width="75" Click="btnOK_Click" IsDefault="True" TabIndex="7" />
        </StackPanel>
        <GroupBox Header="Users">
            <GroupBox.Style>
                <Style></Style>
            </GroupBox.Style>
            <DockPanel>
                <DockPanel DockPanel.Dock="Top" LastChildFill="False">
                    <DockPanel DockPanel.Dock="Top" Margin="2" >
                        <Label Content="Name:" Name="lblName" Width="72" />
                        <Button Click="btnNewUser_Click" Margin="2,0,0,0" Content="Add New" Name="btnNewUser" TabIndex="51" Width="60" DockPanel.Dock="Right" />
                        <xctk:WatermarkTextBox CharacterCasing="Upper" MaxLength="50" Name="txtUserName" TabIndex="50" Watermark="Enter User Name" GotFocus="txtUserName_GotFocus" LostFocus="txtUserName_LostFocus" 
                                       local:Masking.Mask="^[A-Za-z0-9_]*$" ToolTip="Accepts only [A-Za-z0-9] characters" />
                    </DockPanel>
                    <DockPanel DockPanel.Dock="Bottom" Margin="2" >
                        <Label Content="Full Name:" Name="lblFullName" Width="72" />
                        <xctk:WatermarkTextBox MaxLength="50" Name="txtFullName" TabIndex="2" Watermark="Enter full name" HorizontalAlignment="Stretch"
                               Text = "{Binding ElementName=lstUsers, Path=SelectedItem.Row.FULL_NAME, UpdateSourceTrigger=PropertyChanged}"/>

                    </DockPanel>
                </DockPanel>
                <DockPanel DockPanel.Dock="Bottom" LastChildFill="false" >
                    <Button Content="Delete" Margin="2" DockPanel.Dock="Right" Name="btnDelete" TabIndex="6" Width="75" Click="btnDelete_Click" >
                        <Button.Style>
                            <Style>
                                <Setter Property="Button.IsEnabled" Value="True"/>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding ElementName=lstUsers, Path=SelectedIndex}" Value="-1">
                                        <Setter Property="Button.IsEnabled" Value="false" />
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Button.Style>
                    </Button>
                    <CheckBox Content="Enabled" Name="chkUserEnabled" Margin="2" VerticalAlignment="Center"
                      IsChecked ="{Binding ElementName=lstUsers, Path=SelectedItem.Row.ENABLED}" FlowDirection="LeftToRight" TabIndex="5" />
                </DockPanel>
                <ListBox Name="lstUsers" Margin="2"
                         ItemsSource="{Binding Path=UsersTable}" IsSynchronizedWithCurrentItem="True" TabIndex="1">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding DISPLAY_NAME}"/>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </DockPanel>
        </GroupBox>

    </DockPanel>

    <!--<Canvas Height="266"  Name="canvas1" Width="329" Background="#FFD2E2E2">
        <ListBox Canvas.Left="6" Canvas.Top="6" Height="218" Name="lstUsers" Width="120" 
                     ItemsSource="{Binding Path=UsersTable}" IsSynchronizedWithCurrentItem="True" TabIndex="1">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding NAME}"/>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <CheckBox Canvas.Left="261" Canvas.Top="208" Content="Enabled" Height="16" Name="chkUserEnabled" 
                      IsChecked ="{Binding ElementName=lstUsers, Path=SelectedItem.Row.ENABLED}" FlowDirection="RightToLeft" TabIndex="5" />
        <GroupBox Canvas.Left="132" Canvas.Top="2" Header="Add New User" Height="52" Name="groupBox3" Width="188" BorderThickness="0.5">
            <Canvas Height="35">
                <Button Canvas.Left="-114" Canvas.Top="0" Click="btnNewUser_Click" Content="Add New" Height="23" Margin="230,6,6,14" Name="btnNewUser" TabIndex="51" Width="60" />
                <xctk:WatermarkTextBox Canvas.Left="4" Canvas.Top="6" CharacterCasing="Upper" Height="23" MaxLength="50" Name="txtUserName" TabIndex="50" Watermark="Enter User Name" Width="106" GotFocus="txtUserName_GotFocus" LostFocus="txtUserName_LostFocus" 
                                       local:Masking.Mask="^[A-Za-z0-9_]*$" ToolTip="Accepts only [A-Za-z0-9] characters" />
            </Canvas>
        </GroupBox>
        <xctk:WatermarkTextBox Canvas.Left="201" Canvas.Top="89" Height="23" MaxLength="50" Name="txtPassword" TabIndex="3" 
                                   Text = "{Binding ElementName=lstUsers, Path=SelectedItem.Row.PASSWORD}" Watermark="Enter passsord" Width="119" Visibility="Hidden" />
        <Label Canvas.Left="138" Canvas.Top="87" Content="Password:" Height="25" Name="label1" Width="69" Visibility="Hidden" />
        <Rectangle Canvas.Left="0" Canvas.Top="230" Height="1" Name="rectangle1" Stroke="Black" Width="329" Fill="Black" StrokeThickness="10" />
        <Button Canvas.Left="254" Canvas.Top="237" Content="Cancel" Height="23" Name="btnCancel" Width="75" Click="btnCancel_Click" IsCancel="True"  TabIndex="7" />
        <Button Canvas.Left="173" Canvas.Top="237" Content="OK" Height="23" Name="btnOK" Width="75" Click="btnOK_Click" IsDefault="True"  TabIndex="7" />
        <Button Canvas.Left="6" Canvas.Top="237" Content="Delete" Height="23" IsCancel="True" Name="btnDelete" TabIndex="6" Width="75" Click="btnDelete_Click" >
            <Button.Style>
                <Style>
                    <Setter Property="Button.IsEnabled" Value="True"/>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding ElementName=lstUsers, Path=SelectedIndex}" Value="-1">
                            <Setter Property="Button.IsEnabled" Value="false" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Button.Style>

        </Button>
        <xctk:WatermarkTextBox Canvas.Left="201" Canvas.Top="60" Height="23" MaxLength="50" Name="txtFullName" TabIndex="2" Watermark="Enter full name" Width="119" 
                               Text = "{Binding ElementName=lstUsers, Path=SelectedItem.Row.FULL_NAME}"/>
        <Label Canvas.Left="135" Canvas.Top="58" Content="Full Name:" Height="25" Name="lblFullName" Width="72" />
    </Canvas>-->
</local:ChoBaseWindowEx>
